/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


#ifndef __FRAMEWORK_MEMORY_H__
#define __FRAMEWORK_MEMORY_H__


typedef enum {
	TAG_CLIENT,
	TAG_SERVER,
	TAG_COMMON,
	TAG_COLLISION,
	TAG_RENDERER,
	TAG_SOUND,
	TAG_GUI,
	TAG_TEMP
} memoryTag_t;

/*
 ==============================================================================

 FUNCTIONS EXPORTED BY THE ENGINE

 ==============================================================================
*/

typedef struct {
	// Allocates a block of memory of the given size
	void *					(*Alloc)(int size, memoryTag_t tag);

	// Allocates a block of memory of the given size and clears it to zero
	void *					(*ClearedAlloc)(int size, memoryTag_t tag);

	// Frees a block of memory
	void					(*Free)(const void *ptr);

	// Frees all blocks of memory with the given tag
	void					(*TagFree)(memoryTag_t tag);

	// Returns the size of the given block of memory
	int						(*Size)(const void *ptr);

	// Returns the size of all blocks of memory with the given tag
	int						(*TagSize)(memoryTag_t tag);

	// Allocates memory and copies the given string
	char *					(*CopyString)(const char *string, memoryTag_t tag);
} odMemory_t;


#endif	// __FRAMEWORK_MEMORY_H__
